/* ----------------------------------------------------------------------------
 *         ATMEL Microcontroller Software Support
 * ----------------------------------------------------------------------------
 * Copyright (c) 2008, Atmel Corporation
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the disclaimer below.
 *
 * Atmel's name may not be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ----------------------------------------------------------------------------
 */

#ifndef WAV_H
#define WAV_H

#include "main.h"


#define  MODE_DIR   0x01
#define  MODE_SONG  0x02
#define  MODE_PLAY  0x03

#define  STATE_STOP   0x00
#define  STATE_PLAY   0x01
#define  STATE_PAUSE  0x02

#define MAX_SONG	16
#define MAX_DIR		16

#define MENU_COLOR	0x20FD  //  0xFD20


typedef struct _SONGFILE
{
	char  filename[64]; // 8.3 format, not null terminated!
	unsigned long	 fsize;
} SONGFILE;

typedef struct _SONGDIR
{
	char  dirname[64]; // 8.3 format, not null terminated!
} SONGDIR;


//------------------------------------------------------------------------------
//         Exported functions
//------------------------------------------------------------------------------

extern SONGDIR			dir_list[MAX_DIR];
extern int				dir_size;
extern int 				dir_index;

extern SONGFILE			song_list[MAX_SONG];
extern int				song_size;
extern int				song_index;

extern uint8_t		format;
extern uint8_t 		sec;
extern uint8_t 		min;

extern uint8_t 		volume;
extern int	 		wm8978_volume;

extern uint8_t  	play_state;
extern uint8_t  	screen_mode;

extern uint8_t 		button;

void Menu_init(void);
void menu_Start(void);
void menu_Pause(void);
void menu_Resume(void);
void menu_Stop(void);

void Build_Dir_List(void);
void Show_Dir(int mode);
void Build_Song_List(char * dirname);
void Show_Song(int mode);

void Play_Prev(void);
void Play_Next(void);

void DO_Bp_UP(void);
void DO_Bp_DOWN(void);
void DO_Bp_BACK(void);
void DO_Bp_NEXT(void);
void DO_Bp_OK(void);
void DO_Bp_STOP(void);

void menu_clean(void);

void report_status(void);

void process_Usb_Hid_Report_buf(void);

#endif //#ifndef WAV_H


